<?
/*
include "DB/DataBase.class.php";
include "GridSource.class.php";
include "Grid.class.php";
include "GUI/HtmlLink.class.php";

<ul id="sddm">
    <li>
	<a href="#" onmouseover="mopen('m1')" onmouseout="mclosetime()">Opciones</a> 
	<div id="m1" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">
        <a href="#">Perfil</a>
        <a href="#">DHTML Menu</a>

        <a href="#">JavaScript DropDown</a>
        <a href="#">Cascading Menu</a>
        <a href="#">CSS Horizontal Menu</a>
        </div>
    </li>
</ul>
<div style="clear:both"></div>

*/
class GridLinker{
		var $LinksList = array();
	
		public static function Render($matrix, $list = array(), $has_header = true){
		$html = "<table>\n";
					 
		foreach($matrix as $key => $rows){	

			if($has_header && $key ==0) $html .= "<thead>";

			$html .= "<tr>\n";			
			
			foreach($rows as $column){
				if($key%2 == 0)		$html .= "<td>".$column."</td>";
				else				$html .= "<td class=\"selectedRow\">".$column."</td>";
			}
			$html .= "<td>";
			if($has_header && $key == 0){
				$html .= "Opciones";
			}else{
			
			$html .= "<ul id=\"sddm\">
					    <li>
						<a href=\"#\" onmouseover=\"mopen('m$key')\" onmouseout=\"mclosetime()\">Opciones</a> 
						<div id=\"m$key\" onmouseover=\"mcancelclosetime()\" onmouseout=\"mclosetime()\">";
			
				foreach($list as $url)
					$html .= $url->Render($rows)."\n";	
			$html .= "</div>
					</li>
				</ul>
				<div style=\"clear:both\"></div>";
			}
			$html .= "</td>";
			$html .= "\n</tr>\n";
			if($has_header && $key ==0) $html .= "</thead>";
		}
		$html .= "</table>\n";	
		return $html;
	 } #Render

	
	
	
}#GridPresenter
/*
$a = new htmlLink("#","Perfil",0,"?id=","newWindow('http://localhost/','windowTittle')");
$b = new htmlLink("#","Editar",0,"?id=","newWindow('http://localhost/','windowTittle')");
$c = new htmlLink("#","Eliminar",0,"?id=","newWindow('http://localhost/','windowTittle')");
$c = new htmlLink("../delete/socios.php?tabla=socios&redirect=http://www.google.com&id=", "Delete", 0, "", "");

$links = array($a, $b, $c);

$sql = "SELECT
  socios.id,
  CONCAT(socios.nombre,' ', apellido_paterno, ' ',apellido_materno ) Socio,
  grupo_sanguineo,
  fecha_nacimiento,
  paquetes.nombre Paquete
FROM
  socios,
  paquetes
WHERE
  socios.paquete_id = paquetes.id";				
$g = new Grid();
GridDataSource::Fill($g, $sql);

print_r($g->grid);
echo GridLinker::Render($g->grid, $links);
*/
?>